<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>登陆 - {$meta.title}</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta http-equiv="Access-Control-Allow-Origin" content="*">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="__static/lib/layui-v2.5.5/css/layui.css" media="all">
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <style>
        html, body {width: 100%;height: 100%;overflow: hidden}
        body {background: #1E9FFF;}
        body:after {content:'';background-repeat:no-repeat;background-size:cover;-webkit-filter:blur(3px);-moz-filter:blur(3px);-o-filter:blur(3px);-ms-filter:blur(3px);filter:blur(3px);position:absolute;top:0;left:0;right:0;bottom:0;z-index:-1;}
        .layui-container {width: 100%;height: 100%;overflow: hidden;padding: 0;}
        .admin-login-background {display:none; box-shadow:0 0 75px rgb(26,143,242);background-color:#fff;border-radius:5px;width:300px;height:400px;position:absolute;left:50%;top:40%;margin-left:-150px;margin-top:-100px;padding-top:20px;}
    </style>
</head>
<body>
<div class="layui-container" id="holder">
    <div class="admin-login-background" style="width: 320px; height: 460px;">
        <div class="layui-tab">
            <ul class="layui-tab-title">
              <li class="layui-this" style="min-width: 40%;">扫码登录</li>
              <li  style="min-width: 40%;">账户登录</li>
            </ul>
            <div class="layui-tab-content">
              <div class="layui-tab-item layui-show">
                <div id="qywx_qrcode">

                </div>
              </div>
              <div class="layui-tab-item">
                <form class="layui-form" action="">
                    <div class="layui-form-item">
                      <label class="layui-form-label">账号</label>
                      <div class="layui-input-block">
                        <input type="text" name="username" lay-verify="required" lay-verify="title" autocomplete="off" placeholder="请输入账号" class="layui-input">
                      </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">密码</label>
                        <div class="layui-input-block">
                          <input type="password" name="password" lay-verify="required" lay-verify="title" autocomplete="off" placeholder="请输入账号" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn"  lay-submit="" lay-filter="demo1">登录</button>
                        </div>
                    </div>
                </form>
              </div>
              
            </div>
        </div>
        
        
    </div>
</div>
<script src="__static/lib/jquery-3.4.1/jquery-3.4.1.min.js" charset="utf-8"></script>
<script src="__static/lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
<script src="//rescdn.qqmail.com/node/ww/wwopenmng/js/sso/wwLogin-1.0.0.js"></script>
<script src="__static/js/login-bg.js"></script>
<script>
    if (window.top != window) {
        window.top.location = '/login';
    } else {
        window.WwLogin({
            "id" : "qywx_qrcode",  
            "appid" : "{$qywx.corp_id}",
            "agentid" : "{$qywx.agent_id}",
            "redirect_uri" :"{$qywx.redirect_uri}",
            "state" : "{$qywx.state}",
            "href" : "{$qywx.href}",
        });

        document.onreadystatechange = function() {
            console.log(document.readyState);
            if (document.readyState == 'complete') {
                $('.admin-login-background').fadeIn();
            }
        }
    }
</script>
</body>
</html>
<script>
    layui.use(['element','form'], function(){
        var $ = layui.jquery
        ,element = layui.element,form = layui.form; //Tab的切换功能，切换事件监听等，需要依赖element模块
       //监听提交
        form.on('submit(demo1)', function(data){
            var articleFrom = data.field;
            layer.load(1, { shade : [ 0.5, '#676a6c' ] }); 
			$.post("{:url('Index/login')}?t=json",articleFrom,function(data){
				layer.closeAll();
				if (data['code'] == 1) { 
                    layer.msg(data['msg'], { icon : 6 });
                    
                    location.reload();
				} else {
					layer.msg(data['msg'], { icon : 5 });
				}
			});
            
            return false;
        });
    })  
</script>